﻿#region

using JsMapper.BO.Config;

#endregion

namespace JsMapper.BL.Config
{
    public class JsModelFluentConfig : JsModelConfig
    {
        #region Namespace

        public JsModelFluentConfig UseDefaultNamespace(string ns)
        {
            JsNamespace = ns;
            return this;
        }

        public JsModelFluentConfig AndDefaultNamespace(string ns)
        {
            return UseDefaultNamespace(ns);
        }

        public JsModelFluentConfig WithDefaultNamespace(string ns)
        {
            return UseDefaultNamespace(ns);
        }

        #endregion

        #region Cache

        public JsModelFluentConfig AndCacheOutput()
        {
            return CacheOutput();
        }

        public JsModelFluentConfig CacheOutput()
        {
            return SetCache(true);
        }

        public JsModelFluentConfig SetCache(bool c)
        {
            UseCache = c;
            return this;
        }

        public JsModelFluentConfig AndSetCache(bool c)
        {
            return SetCache(c);
        }

        #endregion

        #region Scan From Current Domain

        public JsModelFluentConfig ScanForViewModels()
        {
            return SetScanForViewModels(true);
        }

        public JsModelFluentConfig AndScanForViewModels()
        {
            return SetScanForViewModels(true, false);
        }

        public JsModelFluentConfig SetScanForViewModels(bool s, bool removeSpecificAssemblyScan = true)
        {
            ScanJsModelsFromCurrentDomain = s;
            if(removeSpecificAssemblyScan) ScanJsModelsFromAssembly = null;

            return this;
        }

        #endregion

        #region Scan from specific Assembly

        public JsModelFluentConfig ScanForViewModels(string assemblyPath)
        {
            return SetScanForViewModels(assemblyPath);
        }

        public JsModelFluentConfig AndScanForViewModels(string assemblyPath)
        {
            return SetScanForViewModels(assemblyPath, false);
        }

        public JsModelFluentConfig SetScanForViewModels(string s, bool removeCurrentDomainScan = true)
        {
            if(removeCurrentDomainScan) ScanJsModelsFromCurrentDomain = false;
            ScanJsModelsFromAssembly = s;

            return this;
        }

        #endregion
    }
}